feat(settings): add settings page with theme, stream mode, and path configuration#10
Open
leavraell wants to merge 1 commit intoStoryForgeApp:releasefrom
Open
feat(settings): add settings page with theme, stream mode, and path configuration#10leavraell wants to merge 1 commit intoStoryForgeApp:releasefrom
leavraell wants to merge 1 commit intoStoryForgeApp:releasefrom
Conversation
Comment on lines
+157
to
+159
| <Label htmlFor="modsCachePath">Mods cache</Label> | ||
| <Input | ||
| id="modsCachePath" |
Collaborator
There was a problem hiding this comment.
For the htmlFor and id you can usually use field.name, those are unique too.
| }: { | ||
| form: SettingsFormApi; | ||
| version?: string; | ||
| electroview: ElectroViewContext; |
Collaborator
There was a problem hiding this comment.
Please don't pass electroview into components, instead use the useRPC hook to use rpc.
Prop drilling is not really a good way to go about it.
|
|
||
| function RouteComponent() { | ||
| return <div className="p-2">WIP</div>; | ||
| const { electroview } = useRouteContext({ from: "/settings/" }); |
Collaborator
There was a problem hiding this comment.
Please use the useRPC hook instead.
Comment on lines
+218
to
+220
| const form = useForm({ | ||
| defaultValues: config ?? emptyConfig, | ||
| }); |
Collaborator
There was a problem hiding this comment.
This needs to be moved into the component, since it doesn't do anything here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
markdown
Description
Adds a settings page to the StoryForge UI with three sections:
Appearance — theme picker (Light / Dark / System) saved immediately via the existing theme context
Privacy — stream mode toggle that hides server IP addresses in the UI
Paths — configurable locations for game versions, installations, and mods cache
Stream mode and path settings are persisted to
~/.config/storyforge/config.jsonvia two new RPC handlers (getConfig,setConfig) added to the utils controller. The backend config path helpers inutils.tswere refactored from module-level constants into factory functions to avoid initialization ordering issues withUtils.paths.appData.The UI shows "Unsaved changes" when the form is dirty and "Saved ✓" after a successful save. Values persist across app restarts and the dirty state is preserved when navigating between routes.
Changes
src/mainview/routes/settings/index.tsx— new settings pagesrc/bun/utils.ts— lazy config file helperssrc/bun/controllers/utils.ts—getConfigandsetConfigRPC handlerspackage.json/bun.lock— adds Vitest for test infrastructure. Unit tests for the config layer (src/bun/__tests__/config.test.ts) are included but currently skipped in CI —vi.mock("electrobun/bun")is unreliable in the Vitest 4.x + Bun runtime combination due to the module's native side effects at import time. The test file and config are committed as a foundation for when this is resolved.Screenshots
Checklist
Reviewers